function CWL ( canvas )
{
	this.canvas = canvas;
	this.ctx    = canvas.getContext ( "2d" );

	this.instances = dict ();
}

CWL.prototype.render = function ()
{
	this.instances.iterate ( function ( v, k )
	{
		v.render ();
	} );
};

CWL.widgets = {};

CWL.TOP_LEFT = 1;
CWL.TOP = 2;
CWL.TOP_RIGHT = 4;
CWL.LEFT = 8;
CWL.RIGHT = 16;
CWL.BOTTOM_LEFT = 32;
CWL.BOTTOM = 64;
CWL.BOTTOM_RIGHT = 128;
CWL.CENTER = 256;

CWL.BOX_MODE_HORIZ   = CWL.RIGHT | CWL.LEFT;
CWL.BOX_MODE_VERT    = CWL.TOP | CWL.BOTTOM;
CWL.BOX_MODE_MOVE    = CWL.CENTER;
CWL.BOX_MODE_RESIZE  = CWL.BOX_MODE_HORIZ | CWL.BOX_MODE_VERT | CWL.TOP_LEFT | CWL.TOP_RIGHT | CWL.BOTTOM_LEFT | CWL.BOTTOM_RIGHT;

CWL.BOX_MODE_ALL = CWL.BOX_MODE_RESIZE | CWL.BOX_MODE_MOVE;

CWL.pointers = dict ();

CWL.pointers [ CWL.TOP_LEFT ] = "nw-resize";
CWL.pointers [ CWL.TOP ] = "n-resize";
CWL.pointers [ CWL.TOP_RIGHT ] = "ne-resize";
CWL.pointers [ CWL.LEFT ] = "w-resize";
CWL.pointers [ CWL.RIGHT ] = "e-resize";
CWL.pointers [ CWL.BOTTOM_LEFT ] = "sw-resize";
CWL.pointers [ CWL.BOTTOM ] = "s-resize";
CWL.pointers [ CWL.BOTTOM_RIGHT ] = "se-resize";
CWL.pointers [ CWL.CENTER ] = "pointer";
CWL.pointers [ "default"  ] = "default";

CWL.VISIBLE = 1;
CWL.LOCKED  = 2;
